#include "glError.h"

#include <stdio.h>

bool glCheckError(int line, const char *file)
{
    GLenum gl_error = glGetError();
    switch(gl_error)
    {
        case GL_INVALID_ENUM:
            fprintf(stderr, "GLenum argument out of range @ file %s line %d\n", file, line);
            break;
        case GL_INVALID_VALUE:
            fprintf(stderr, "Numeric argument out of range @ file %s line %d\n",  file, line);
            break;
        case GL_NO_ERROR:
            break;
        default:
            fprintf(stderr, "Unknown error @ file %s line %d\n",  file, line);
            break;
    }

    // return true if error actually happened
    return gl_error != GL_NO_ERROR;
}